import type { App } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'

const constantRoutes = [
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/upload',
    children: [
      {
        path: 'upload',
        component: () => import('@/views/upload/index.vue')
      }
    ]
  }
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: constantRoutes
})

export function setupRouter(app: App<Element>) {
  app.use(router)
}

export default router
